//
//  RootViewController.m
//  Album
//
//  Created by Mars_ZXB on 16/7/20.
//  Copyright © 2016年 BAT3. All rights reserved.
//

#import "RootViewController.h"
#import "SecondViewController.h"
#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height
@interface RootViewController ()

@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor =[UIColor whiteColor];
    self.navigationController.navigationBar.barTintColor = [UIColor grayColor];
    self.title = @"相册";
    self.navigationController.navigationBar.translucent = NO;
    //  UILabel *labelLift = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 30)];
    //  labelLift.text = @"返回";
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(fanhui)];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"设置" style:UIBarButtonItemStylePlain target:self action:@selector(shezhi)];
    for (NSInteger i = 0; i < 3; i++) {
        UIImageView *imageOneLine = [[UIImageView alloc]initWithFrame:CGRectMake(20 + ((WIDTH - 40) / 3) * i, 20, (WIDTH - 40) / 3 ,(HEIGHT - 80) / 3)];
        imageOneLine.image = [UIImage imageNamed:(NSString *)[NSString stringWithFormat:@"h%ld.jpeg",i]];
        [self.view addSubview:imageOneLine];
    }
    
    for (NSInteger i = 0; i < 3; i++) {
        UIImageView *imageOneLine = [[UIImageView alloc]initWithFrame:CGRectMake(20 + ((WIDTH - 40) / 3) * i, 20 + ((HEIGHT - 80) / 3), (WIDTH - 40) / 3 ,(HEIGHT - 80) / 3)];
        imageOneLine.image = [UIImage imageNamed:(NSString *)[NSString stringWithFormat:@"h%ld.jpeg",i + 3]];
        [self.view addSubview:imageOneLine];
    }
    
    
    for (NSInteger i = 0; i < 3; i++) {
        UIImageView *imageOneLine = [[UIImageView alloc]initWithFrame:CGRectMake(20 + ((WIDTH - 40) / 3) * i, 20 + (((HEIGHT - 80) / 3) * 2), (WIDTH - 40) / 3 ,(HEIGHT - 80) / 3)];
        imageOneLine.image = [UIImage imageNamed:(NSString *)[NSString stringWithFormat:@"h%ld.jpeg",i + 6]];
        [self.view addSubview:imageOneLine];
    }
    
    for (NSInteger i = 0; i < 3; i++) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.tag = 1000 + i;
        button.backgroundColor = [UIColor clearColor];
        button.frame = CGRectMake(20 + ((WIDTH - 40) / 3) * i, 20, (WIDTH - 40) / 3 ,(HEIGHT - 80) / 3);
        [self.view addSubview:button];
        [button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    
    for (NSInteger i = 0; i < 3; i++) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.tag = 1003 + i;
        button.backgroundColor = [UIColor clearColor];
        button.frame = CGRectMake(20 + ((WIDTH - 40) / 3) * i, 20 + ((HEIGHT - 80) / 3), (WIDTH - 40) / 3 ,(HEIGHT - 80) / 3);
        [self.view addSubview:button];
        [button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    }
    
    for (NSInteger i = 0; i < 3; i++) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.tag = 1006 + i;
        button.backgroundColor = [UIColor clearColor];
        button.frame = CGRectMake(20 + ((WIDTH - 40) / 3) * i, 20 + (((HEIGHT - 80) / 3) * 2), (WIDTH - 40) / 3 ,(HEIGHT - 80) / 3);
        [self.view addSubview:button];
        [button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    }
    
}

-(void)click:(UIButton *)button{
    SecondViewController *vc = [[SecondViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
    vc.number = button.tag;
    
}
-(void)fanhui{
    
}

-(void)shezhi{
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */


@end
